import axios from "../utils/requestAxios";

// 获取首页数据
// http://manhua.weibo.cn/wbcomic/home/page_recommend_list?mca=h5_recommend_female&_type=h5
export const getHomeData = () => {
    return axios.get("/carton/wbcomic/home/page_recommend_list?mca=h5_recommend_female&_type=h5").catch(err => console.log(err));
};

// 获取首页下的 放送表 数据
// http://manhua.weibo.cn/wbcomic/comic/daypub_list?pub_day=&page_num=1&rows_num=20&_type=h5
export const getDayData = () => {
    return axios.get("/carton/wbcomic/comic/daypub_list?pub_day=&page_num=1&rows_num=20&_type=h5").catch(err => console.log(err))
}

// 获取分类页面下的 分类名称 数据
export const getClassifyName = () => {
    return axios.get("/carton/wbcomic/comic/filter_list?_type=h5").catch(err => console.log(err))
}

// 获取 分类 具体数据 http://manhua.weibo.cn/wbcomic/comic/filter_result?cate_id=0&end_status=0&comic_pay_status=0&page_num=1&rows_num=20&order=&_type=h5
// 三个全部 ：       http://manhua.weibo.cn/wbcomic/comic/filter_result?cate_id=0&end_status=0&comic_pay_status=0&page_num=1&rows_num=20&order=&_type=h5
// 剧情 全部 全部   http://manhua.weibo.cn/wbcomic/comic/filter_result?cate_id=1&end_status=0&comic_pay_status=0&page_num=1&rows_num=20&order=&_type=h5
/**
  cate_id: 5
  end_status: 0
  comic_pay_status: 0
  page_num: 1
  rows_num: 20
  order
  _type: h5
*/
/**
 * @param {string} cate_id 一
 * @param {string} end_status 二
 * @param {string} comic_pay_status 三
 * @param {Number} page_num 第几页
 * @param {Number} rows_num 数量
 */
export const getClassifyData = (params) => {
    return axios.get("/carton/wbcomic/comic/filter_result", {
        params,
    }).catch(err => console.log(err))
}

// 获取排行页面数据 (阅读版、新作榜、综合榜)
// 阅读榜 http://manhua.weibo.cn/wbcomic/home/rank_read?_type=h5
export const getReadRank = () => {
    return axios.get("/carton/wbcomic/home/rank_read?_type=h5")
}

// 新作榜 http://manhua.weibo.cn/wbcomic/home/rank_share?_type=h5
export const getNewDoRank = () => {
    return axios.get("/carton/wbcomic/home/rank_share?_type=h5")
}

// 综合榜 http://manhua.weibo.cn/wbcomic/home/rank?_type=h5
export const getAllRank = () => {
    return axios.get("/carton/wbcomic/home/rank?_type=h5")
}

// 获取漫画完结数据
// http://manhua.weibo.cn/wbcomic/home/recommend_list?location_en=ending_works_list&_type=h5
export const getComicEndData = () => {
    return axios.get("/carton/wbcomic/home/recommend_list?location_en=ending_works_list&_type=h5")
}

// 搜索漫画
// http://manhua.weibo.cn/wbcomic/home/hot_words?_type=h5
export const getHotSearch = () => {
    return axios.get("/carton/wbcomic/home/hot_words?_type=h5")
}

// 获取漫画搜索结果
// http://manhua.weibo.cn/wbcomic/home/search?word=斗罗大陆&page_num=1&_type=h5
export const getSearchResult = (params) => {
    return axios.get("/carton/wbcomic/home/search", {
        params,
    })
}

// 首页下的，获取更多数据
// http://manhua.weibo.cn/wbcomic/home/recommend_list?location_en=h5_recommend_female_new_arrival&_type=h5
export const getMoreData = (params) => {
    return axios.get("/carton/wbcomic/home/recommend_list", {
        params,
    })
}

// 获取动漫详情数据
// http://manhua.weibo.cn/wbcomic/comic/comic_show?comic_id=71229&create_source=h5&_=1588262343052&_type=h5
// http://manhua.weibo.cn/wbcomic/comic/comic_show?comic_id=68665&create_source=h5&_=1588262486163&_type=h5
// http://manhua.weibo.cn/wbcomic/comic/comic_show?comic_id=71554&create_source=h5&_=1588262636506&_type=h5
export const getDetailData = (params) => {
    return axios.get("/carton/wbcomic/comic/comic_show", {
        params,
    })
}

// get readcomics data
export const getReadComics = (params) => {
    return axios.get("/carton/wbcomic/comic/comic_play", {
        params,
    })
}

// 获取漫画评论
export const getComment = (params) => {
    return axios.get("/carton/wbcomic/comic/comic_comment_list", {
        params,
    })
}